package com.ayz.gateway.core.authorization;

import lombok.Data;
import org.apache.shiro.authc.AuthenticationToken;

/**
 * @ClassName GatewayAuthorizingToken
 * @Description TODO: 网关的鉴权Token
 * @Author 快乐的星球
 * @Date 2023/5/11 11:55
 * @Version 1.0
 **/
@Data
public class GatewayAuthorizingToken implements AuthenticationToken {

    private static final long serialVersionUID = 1L;
    /**
     * Netty连接通道的唯一标识ID
     */
    private String channelId;
    /**
     * Token密钥
     */
    private String token;
    /**
     * 服务端的私钥
     */
    private String singingKey;

    public GatewayAuthorizingToken(String channelId, String token, String singingKey) {
        this.channelId = channelId;
        this.token = token;
        this.singingKey = singingKey;
    }

    @Override
    public Object getPrincipal() {
        return channelId;
    }
    //凭证 一般是服务端颁发的TOKEN
    @Override
    public Object getCredentials() {
        return token;
    }
}
